app.controller('balanceHistoryCtrl', ['$scope','$state','balanceHistoryService','toaster','utilService','$filter',
    function($scope,$state,balanceHistoryService,toaster,utilService,$filter) {

        $scope.headerData={};
        $scope.findHeaderData= function() {
            balanceHistoryService.findHeaderData($scope).then(function (result) {
                switch (result.status) {
                    case 200:
                        $scope.headerData=result.data;
                        $scope.headerData.time=new Date();
                        break;
                    default :
                        toaster.pop('error', "操作失败", "发生未知错误！请联系管理员");
                        break;
                }
            });
        };
        $scope.findHeaderData();

        $scope.balance={
            operation:0
        };
        $scope.query = function(){
            $scope.balance.startDate = $filter("date")($scope.balance.startDate, "yyyy-MM-dd");
            $scope.balance.endDate = $filter("date")($scope.balance.endDate, "yyyy-MM-dd");
            utilService.queryForPagingList($scope,{
                url:$scope.app.domain + 'balance',
                params:$scope.balance
            }).then(function(result){
            });
        };
        $scope.query();
    }
]);